package com.hello;

import akka.actor.UntypedActor;

public class Greeter extends UntypedActor {

    public static enum Msg {
        GREET, DONE;
    }

    @Override
    public void onReceive(Object msg) {
        if (msg == Msg.GREET) {
            //得到Msg.GREET消息，打印
            System.out.println("Hello World!");
            // 得到当前消息的发送者，并告诉这个发送者消息应经处理完成，
            // 此时Msg.DONE的发送者是self
            getSender().tell(Msg.DONE, getSelf());
        } else
            unhandled(msg);
    }

}
